<?php
/**
 * beimuaihui System
 * Copyright(c) 2011-2020 beimuaihui.
 * @license    http://www.gnu.org/licenses/gpl.html     This software Under GPL V3 License
 * beimuaihui@gmail.com
 * http://code.google.com/p/beimuaihui/
 * $Id: IndexController.php 228 2011-05-20 03:18:14Z beimuaihui $
 */
require_once 'Zend/Controller/Action.php';
class Microblog_EmailController extends Baogg_Controller_Action_Site
{
	/**
	 * The default action - show the home page
	 */
	public function sendAction ()
	{
		$params=$this->getRequest()->getParams();	
		
		
		$file_content=@$params['file_content'];
		if(is_array($file_content)){
			$file_content=implode("",$file_content);
		}	
		
		$config = array('auth' => 'login',
		                'username' => 'ormer2011@126.com',
		                'password' => '******');		
		$transport = new Zend_Mail_Transport_Smtp('smtp.126.com', $config);
		
		$attach='/home/bob/Downloads/201108121954471768564768.zip';
		$at = new Zend_Mime_Part( file_get_contents($attach));
		$at->type = 'application/zip';
		$at->disposition = Zend_Mime::DISPOSITION_INLINE;
		$at->encoding = Zend_Mime::ENCODING_BASE64;
		$at->filename = '201108121954471768564768.zip';
		
		
		$mail = new Zend_Mail();
		$mail->setBodyHtml($file_content);//setBodyHtml;setBodyText
		$mail->setFrom('ormer2011@126.com', 'Sohu From Beimu');
		$mail->addTo('22376415@qq.com', 'Some Email');
		$mail->setSubject('Test Email');
		$mail->addAttachment($at);
		$mail->send($transport);
		
		$this->_helper->viewRenderer->setNoRender();
	}
	
}